package cloud.keveri.gateway.plugin.api.support;

import cloud.keveri.base.KeveriException;

import static cloud.keveri.base.GlobalErrorCodeConstants.PARAM_INVALID;

/**
 * <p>
 * 作者：沈自在
 **/
public class ParamCheckUtils {

    /**
     * Body is empty boolean.
     *
     * @param body the body
     * @return the boolean
     */
    public static boolean bodyIsEmpty(final String body) {
        return null == body || "".equals(body) || "null".equals(body);
    }

    /**
     * Check params length.
     *
     * @param argsLength  params length.
     * @param typesLength types length.
     */
    public static void checkParamsLength(final Integer argsLength, final Integer typesLength) {
        if (argsLength < typesLength) {
            throw new KeveriException(PARAM_INVALID);
        }
    }
}
